package com.qianyu.exception;

import com.qianyu.enumerate.ResultEnum;
import lombok.Data;

/**
 * @author wangzhic
 * @data 2020/8/4 13:49
 * 功能描述 自定义异常
 **/
@Data
public class CustomerException extends RuntimeException {
    /** 功能描述 状态码
     */
    private Integer code;

    public CustomerException(ResultEnum resultEnum) {
        super(resultEnum.getMsgTranslation());
        this.code = resultEnum.getCode();
    }

    public CustomerException(String errorMsg) {
        super(errorMsg);
        this.code = 500;
    }
}
